package com.mjy.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/demo/{routeKey}")
    public String demo(@PathVariable("routeKey") String  routeKey){
     rabbitTemplate.convertAndSend("X", routeKey, "hello world ");
     return "消息发送完毕";
    }

























}
